home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16072 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: news.nyu.edu!schonberg!dewar
  2. From: dewar@cs.nyu.edu (Robert Dewar)
  3. Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.edu
  4. Subject: Re: ANSI C and POSIX (was Re: C/C++ knocks the crap out of Ada)
  5. Date: 9 Apr 1996 07:53:15 -0400
  6. Organization: Courant Institute of Mathematical Sciences
  7. Message-ID: <dewar.829050467@schonberg>
  8. References: <JSA.96Feb16135027@organon.com> <4kb2j8$an0@solutions.solon.com> <4kbrt5$k3h@mulga.cs.mu.OZ.AU> <dewar.829012486@schonberg> <4kcpgkINNcku@keats.ugrad.cs.ubc.ca>
  9. NNTP-Posting-Host: schonberg.cs.nyu.edu
  10. X-Newsreader: NN version 6.5.0 (NOV)
  11.  
  12. Kazimir quoted "Peter's FAQ" as saying:
  13.  
  14. 1.3:    If I write the code
  15.  
  16.                 int i, j;
  17.  
  18.         can I assume that (&i + 1) == &j?
  19.  
  20. A:      Only sometimes.  It's not portable, because in EBCDIC, i and j are
  21.         not adjacent.
  22.  
  23.  
  24. I think a smiley is missing here. This is a nice joke, but one can only
  25. hope that no one thinks that the EBCDIC comment is technically relevant.
  26.  
  27. Incidentally, the answer that int should always be 64 bits on a 64-bit
  28. machine is far too facile. This is a very tricky question, which has been
  29. debated endlessly and no satisfactory solution found. There are very
  30. delicate tradeoffs to be made between efficiency, functionality, and
  31. portability here, and the final outcome is far from clear. Lots of C
  32. programs assume that long is 32 bits. Yes of course they are broken,
  33. yes of course this was a naughty assumption (of course ther is no way
  34. in C to get a guaranteed 32-bit integer type, so it is not surprising
  35. that C code is often broken in this manner). This means that making
  36. int (and hence long?) 64 bits caues serious porability problems.
  37.  
  38. Yes, of course I talk about portability problems in a pragmatic sense,
  39. it is the only useful sense in whch to discuss them, since the discussion
  40. in purely language terms is vacuuous.
  41.  
  42.